<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改密码</title>
<link href="../css/table.css" rel="stylesheet" type="text/css">
</head>
<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
	function updatePass(){
		$.post("md5User.action",{"md5pass":$("#oldpass").val()},function(data){
			if(data =='0'){
				alert("原密码输入错误,请重新输入!");
				$("#oldpass").val("");
				$("#newpass1").val("");
				$("#newpass2").val("");
			}else{
				if($("#newpass1").val()!=$("#newpass2").val()){
					alert("两次密码输入不一致!");
					$("#oldpass").val("");
					$("#newpass1").val("");
					$("#newpass2").val("");
				}else{
					$.post("updatePassUser.action",{"pass":$("#newpass1").val()},function(data){
						if(data=='1'){
							alert("修改成功");
							location.href='../firm/default.html';
						}else{
							alert("修改失败");
						}
						
					},'json');
				}
			}
			
		},'json');
		
		
	}
	
</script>
<body>
	
		<table width="500" border="0" cellpadding="0" cellspacing="00">
			<input type="hidden" id="yhpass" name="yhpass" value='<s:property value="#session.USER.usPass"/>'/>
			<tr>
				<td class="table_rightf">原密码:</td>
				<td class="tableleftf"><input type="password" id="oldpass" name=""/> </td>
			</tr>
			<tr>
				<td class="table_rightf">新密码:</td>
				<td class="tableleftf"><input type="password" id="newpass1" name=""/> </td>
			</tr>
			<tr>
				<td class="table_rightf">重新输入新密码:</td>
				<td class="tableleftf"><input type="password" id="newpass2" name=""/> </td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td><input type="button" value="修改" onClick="updatePass(); "/>				  <input type="reset" value="重置"/></td>
			</tr>
		</table>
</body>
</html>